<!-- 自定义配置 -->
<template>
    <div>
        <imglist ref="imglist" @change="handleSetimg"></imglist>
        <el-collapse accordion>
            <el-collapse-item title="产线设置">
                <el-form-item label="宽度">
                    <avue-input-number v-model="main.activeOption.line.width">
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="高度">
                    <avue-input-number v-model="main.activeOption.line.height">
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="右间距">
                    <avue-input-number v-model="main.activeOption.line.mRight">
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="下间距">
                    <avue-input-number v-model="main.activeOption.line.mBottom">
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="字体行高">
                    <avue-input-number
                        v-model="main.activeOption.line.lineHeight"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体间距">
                    <avue-input-number
                        v-model="main.activeOption.line.split"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体类型">
                    <avue-select
                        filterable
                        allow-create
                        v-model="main.activeOption.line.fontFamily"
                        :dic="dicOption.fontFamily"
                    ></avue-select>
                </el-form-item>
                <el-form-item label="字体大小">
                    <avue-input-number
                        v-model="main.activeOption.line.fontSize"
                        :max="200"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体颜色">
                    <avue-input-color
                        v-model="main.activeOption.line.color"
                    ></avue-input-color>
                </el-form-item>

                <el-form-item label="字体背景">
                    <avue-input-color
                        v-model="main.activeOption.line.backgroundColor"
                    ></avue-input-color>
                </el-form-item>
                <el-form-item label="文字粗细">
                    <avue-select
                        v-model="main.activeOption.line.fontWeight"
                        :dic="dicOption.fontWeight"
                    >
                    </avue-select>
                </el-form-item>
                <el-form-item label="对齐方式">
                    <avue-select
                        v-model="main.activeOption.line.textAlign"
                        :dic="dicOption.textAlign"
                    >
                    </avue-select>
                </el-form-item>
            </el-collapse-item>
            <el-collapse-item title="设备设置">
                <el-form-item label="宽度">
                    <avue-input-number
                        v-model="main.activeOption.equipment.width"
                    >
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="高度">
                    <avue-input-number
                        v-model="main.activeOption.equipment.height"
                    >
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="右间距">
                    <avue-input-number
                        v-model="main.activeOption.equipment.mRight"
                    >
                    </avue-input-number>
                </el-form-item>
                <el-form-item label="字体行高">
                    <avue-input-number
                        v-model="main.activeOption.equipment.lineHeight"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体间距">
                    <avue-input-number
                        v-model="main.activeOption.equipment.split"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体类型">
                    <avue-select
                        filterable
                        allow-create
                        v-model="main.activeOption.equipment.fontFamily"
                        :dic="dicOption.fontFamily"
                    ></avue-select>
                </el-form-item>
                <el-form-item label="字体大小">
                    <avue-input-number
                        v-model="main.activeOption.equipment.fontSize"
                        :max="200"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="字体颜色">
                    <avue-input-color
                        v-model="main.activeOption.equipment.color"
                    ></avue-input-color>
                </el-form-item>

                <el-form-item label="字体背景">
                    <avue-input-color
                        v-model="main.activeOption.equipment.backgroundColor"
                    ></avue-input-color>
                </el-form-item>
                <el-form-item label="文字粗细">
                    <avue-select
                        v-model="main.activeOption.equipment.fontWeight"
                        :dic="dicOption.fontWeight"
                    >
                    </avue-select>
                </el-form-item>
                <el-form-item label="对齐方式">
                    <avue-select
                        v-model="main.activeOption.equipment.textAlign"
                        :dic="dicOption.textAlign"
                    >
                    </avue-select>
                </el-form-item>
                <el-form-item label="设备图片宽度">
                    <avue-input-number
                        v-model="main.activeOption.equipment.imgWidth"
                        :min="0"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="设备图片高度">
                    <avue-input-number
                        v-model="main.activeOption.equipment.imgHeight"
                        :min="0"
                    ></avue-input-number>
                </el-form-item>
                <el-form-item label="运行设备图片">
                    <img
                        :src="main.activeOption.equipment.runImgUrl"
                        @click="handleOpenImg('runImgUrl')"
                        alt=""
                        width="100%"
                    />
                    <el-input
                        clearable
                        v-model="main.activeOption.equipment.runImgUrl"
                    >
                        <div @click="handleOpenImg('runImgUrl')" slot="append">
                            <i class="iconfont icon-img"></i>
                        </div>
                    </el-input>
                </el-form-item>
                <el-form-item label="停机设备图片">
                    <img
                        :src="main.activeOption.equipment.stopImgUrl"
                        @click="handleOpenImg('stopImgUrl')"
                        alt=""
                        width="100%"
                    />
                    <el-input
                        clearable
                        v-model="main.activeOption.equipment.stopImgUrl"
                    >
                        <div @click="handleOpenImg('stopImgUrl')" slot="append">
                            <i class="iconfont icon-img"></i>
                        </div>
                    </el-input>
                </el-form-item>
            </el-collapse-item>
        </el-collapse>
    </div>
</template>

<script>
import { tableAlarmOption } from "@/option/config";
import codeedit from "../../page/group/code";
import { dicOption } from "@/option/config";
import imglist from "@/page/group/imglist";
export default {
    name: "lineEquipmentList",
    inject: ["main", "contain"],
    components: {
        codeedit,
        imglist
    },
    data() {
        return {
            dicOption: dicOption,
            tableAlarmOption: tableAlarmOption,
            code: {
                box: false,
                type: "data",
                obj: {}
            }
        };
    },
    methods: {
        rowSave(row, done) {
            this.main.activeOption.column.push(this.deepClone(row));
            done();
        },
        rowDel(row, index) {
            this.main.activeOption.column.splice(index, 1);
        },
        rowUpdate(row, index, done) {
            this.main.activeOption.column.splice(index, 1, this.deepClone(row));
            done();
        },
        codeClose(value) {
            this.main.activeOption.column = value;
        },
        openCode() {
            this.code.obj = this.main.activeOption.column;
            this.code.box = true;
        },
        //打开图库
        handleOpenImg(item, type) {
            this.$refs.imglist.openImg(item, type);
        },
        //图库框回调赋值
        handleSetimg(val, type) {
            this.main.activeOption.equipment[type] = val;
        }
    }
};
</script>

<style></style>
